package com.ds.infrastructure.audit.collector.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 作用：
 *
 * @author WeiShaoying
 * @date 2020/8/5
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RateAccess {

    private String prefix;

    private String key;

    private int window;

    private long frequency;

    /**
     * 静态方法
     *
     * @param prefix
     * @param key
     * @param window
     * @param frequency
     * @return
     */
    public static RateAccess of(String prefix, String key, int window, long frequency) {
        return new RateAccess(prefix, key, window, frequency);
    }

    /**
     * 静态方法
     *
     * @param prefix
     * @param key
     * @param frequency
     * @return
     */
    public static RateAccess of(String prefix, String key, long frequency) {
        return new RateAccess(prefix, key, 1, frequency);
    }

}
